package com.xdb.sqlparser.dialect.oracle.ast.statement;

import java.util.ArrayList;
import java.util.List;

import com.xdb.sqlparser.ast.SQLExpr;
import com.xdb.sqlparser.ast.SQLStatement;
import com.xdb.sqlparser.dialect.oracle.ast.OracleSQLObjectImpl;
import com.xdb.sqlparser.dialect.oracle.visitor.OracleASTVisitor;

public class OracleExceptionStatement extends OracleStatementImpl implements OracleStatement {

	private List<Item> items = new ArrayList<Item>();

	public List<Item> getItems() {
		return items;
	}

	public void setItems(List<Item> items) {
		this.items = items;
	}

	public static class Item extends OracleSQLObjectImpl {

		private SQLExpr when;
		private List<SQLStatement> statements = new ArrayList<SQLStatement>();

		public SQLExpr getWhen() {
			return when;
		}

		public void setWhen(SQLExpr when) {
			this.when = when;
		}

		public List<SQLStatement> getStatements() {
			return statements;
		}

		public void setStatements(List<SQLStatement> statements) {
			this.statements = statements;
		}

		@Override
		public void accept0(OracleASTVisitor visitor) {
			if (visitor.visit(this)) {
				acceptChild(visitor, when);
				acceptChild(visitor, statements);
			}
			visitor.endVisit(this);
		}

	}

	@Override
	public void accept0(OracleASTVisitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, items);
		}
		visitor.endVisit(this);
	}
}
